#include "EquationSolver.h"
#include <iostream>
#include <cmath>
//#define M_PI 3.14159265358979323846


double Function :: operator()(double _x)
{
    return (0.5*M_PI-asin(_x)-_x*pow(1-_x*_x,1/2)-1.24);//令h/r=_x
}
double Function :: diff(double _x)
{
    return ((2*_x*_x-2)/(pow(1-_x*_x,0.5)));
};

int main()
{
    Function func;
    Bisection bis(0, 1, 0.01, 100, func);
    Newton New(0.2, 100 , func);
    Secant sec(0, 0.2 , 0.01, 100, func);
    std::cout << "二分法：" << 1-bis.solve()*1 << std::endl;
    std::cout << "牛顿法：" << 1-New.solve()*1 << std::endl;
    std::cout << "割线法：" << 1-sec.solve()*1 << std::endl;
    return 0;
};